The present invention relates to communication between a local messaging system and a remote messaging system. More specifically, the invention utilizes a source-queue-specific priority values stored in a priority table of a bridge to determine a priority for delivering queued messages.
Asynchronous transfer of messages between application programs running on different data processing systems within a network is well known in the art. A sender application program issues a command to send (put) a message to a target queue, and a queue manager handles the complexities of transferring the message from the sender to the target queue.
Within a messaging network, messages may be delivered from one data processing system to another via one or more “message brokers” that provide routing and, in many cases, transformations and other services. The brokers are typically located at communication hubs within the network, although broker functions may be implemented at various points within a distributed broker network.
Sometimes it is necessary to connect a local message broker to a remote message broker. It is known to do this via a bridge and to configure the bridge by defining an outbound set of source queues on the local broker and one or more target queue on the remote broker and vice versa to enable the two brokers to communicate messages with one another. A source queue may represent, for example, a subscriber's subscription to a particular topic in a publish/subscribe system.
Such a scenario is illustrated in FIG. 1 (Prior Art). A local message broker 10 comprises a set of source queues 20, 30, 40. Messages are stored on each source queue 20-40 in sub-queues by priority order. Bridge 50 includes a listener 60 which registers a call back with source queues that are of interest to a remote broker 90. Every time a message arrives on a source queue 20-40 for which the listener 60 has registered an interest, that message is sent from the relevant source queue 20-40 to the bridge 50 and is placed by the listener 60 on transmission queue 70. Listener 80 listens on the transmission queue 70 for a new message and moves this across the bridge 50 to a destination queue 95 on remote message broker 90.
In this example, it is assumed that both the local 10 and remote 90 brokers are, under normal conditions, always connected via the bridge 50, so that when a message becomes available for transmission, it is queued for dispatch immediately (i.e., asynchronous message delivery). All messages for transmission to the remote messaging broker 90 are received by the single transmission queue 70.
The benefit of a single transmission queue 70 is that priority and ordering can be honored in one place. However consuming from multiple queues 10-30 creates a conundrum. Across the set of queues 20-40 that the bridge 50 is consuming from there may be many high-priority messages. The bridge 50 must ensure that messages are delivered in priority order and in queued order for each queue 20-40. A couple of known approaches are:                (i) Each source queue is not a real queue but an alias to a transmission queue. All messages sent to the alias queue are put directly onto a single outbound transmission queue.        (ii) Messages from each source queue are consumed and routed to a single outbound transmission queue.        
Both approaches have drawbacks including:                1. Additional overhead in storing messages on two queues. This is a drawback of approach (ii) where it is desirable to store messages for a source queue and also the transmission queue.        2. Limitation in maximum queue depth of a single transmission queue.        
This is applicable to both approaches above.                3. Difficulty in controlling depth of messages by source queue. This is because with approach (i), messages are not initially stored on a source queue but are routed immediately to a single transmission queue. Thus it is harder to specify and control the depth of messages by source queue.        4. Difficulty in pausing and resuming messages delivery of messages by source queue. This is applicable to approach (i).        
A transmission queue can only hold a finite number of messages at any given time. Consider the situation where there are four queues that are consumed from, and one transmission queue. It is perfectly valid that across those four queues there are many more messages then can be contained on a single transmission queue. The bridge than has to consider fairness across all the queues in terms of which queue has its messages put into the transmission queue.
It is also known for a remote client to register a call back with each source queue that it is interested in receiving messages from. When a message arrives on one of those source queues, the priority of that message is examined and a reference to that message is moved into an intermediate data structure (for example, a FIFO structure) with the reference to the message being removed from the source queue. There is an intermediate data structure for each message priority. This means that it is not necessary to lock each structure when performing processing, but only the particular priority structure in question. At transmission point, the highest priority structures are drained first. This solution again relies on intermediate structures which have a finite amount of space.